<?php

namespace app\dao\product;

use app\dao\BaseDao;
use app\model\product\Brand;

class BrandDao extends BaseDao
{

    protected function setModel(): string
    {
        return Brand::class;
    }

    public function getList(array $where, int $page = 0, int $limit = 0, string $order = '')
    {
        $query = $this->search($where, false)->order(($order ? $order . ' ,' : '') . 'id desc');
        if (isset($where['name']) && $where['name']) {
            $query->where('name', 'like', '%'. $where['name'] . '%');

        }
        return $query->where('is_del', 0)->paginate($limit);
    }

}